package cn.wit.sst.collection;

import java.util.Objects;

/**
 * @author hchaojie
 *
 */
public class Student {
	private String name;
	private int age;

	public Student(String name, int age) {
		this.name = name;
		this.age = age;
	}

	@Override
	public int hashCode() {
		return Objects.hash(this.age, this.name);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;

		if (!(obj instanceof Student))
			return false;

		Student other = (Student) obj;

		return (Objects.equals(this.name, other.name)
				&& this.age == other.age);
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Student [name=");
		builder.append(name);
		builder.append(", age=");
		builder.append(age);
		builder.append("]");
		return builder.toString();
	}
}
